<template>
	<view>
		<view class="content">
			<zc-parse :html="articleContent" show-with-animation lazy-load :autocopy="false"></zc-parse>
		</view>
		<view v-if="!articleContent && isNoDataShow" class="uni-tab-bar-loading" style="text-align: center;">
			<view class="no_model">
				<image :src="imgPath+'UniImages/no_data.png'" mode="widthFix" style="width: 100%;"></image>
				<view class="no_text">暂无数据</view>
			</view>
		</view>
	</view>
</template>

<script>
	import zcParse from "../../components/jyf-Parser/index.vue"
	
	let _this;
	export default {
		components:{
			zcParse
		},
		data() {
			return {
				imgPath:this.$ZcPublic.Domain,
				isNoDataShow:false,
				SN:'',
				articleContent:''
			}
		},
		onLoad(res) {
			_this = this;
			console.log('文章详情参数 = ',res.SN);
			if (res.SN) {
				_this.SN = res.SN;
				_this.zcGetPublicArticle();
			}
		},
		methods: {
			zcGetPublicArticle() {
				_this.$ZcPublic.Server.Post({
					IsNeedLogin: true,
					Paras: {
						Name: 'uni_Insure_Detail',
						Action: 'Ext_GetPublicArticle',
						Data: {
							SN:_this.SN
						}
					},
					Callback:function(resjson,scope) {
						if (resjson.state === 'back') {
							console.log('文章详情 = ',resjson.data);
							if (!resjson.success) {
								uni.showModal({
									title:'温馨提示',
									showCancel:false,
									content:''+resjson.msg
								})
								return;
							}
							
							if (resjson.data !== null) {
								_this.articleContent = resjson.data.Content;
								_this.isNoDataShow = true;
							}
						} else{
							
						}
						
					},
					Scope: this
				})
			},
			preview(src, e) {
				// do something
				console.log("src: " + src);
			},
			navigate(href, e) {
				// 如允许点击超链接跳转，则应该打开一个新页面，并传入href，由新页面内嵌webview组件负责显示该链接内容
				console.log("href: " + href);
				uni.showModal({
					content : "点击链接为：" + href,
					showCancel:false
				})
			}
		}
	}
</script>

<style>
	/* @import url("../../components/zcParse/wxParse.css"); */
	
	.content{
		background-color: #FFFFFF;
		padding: 30upx;
		height: 100%;
		width: 100%;
		box-sizing: border-box;
		position: absolute;
	}
	.title{font-size: 32upx;margin-bottom: 30upx;}
	
	/* 分页底部说明样式 */
	.uni-tab-bar-loading{text-align: center;margin: 0;}
	
	/* 无数据样式 */
	.no_model{position: relative;display: flex;flex-direction: column;align-items: center;padding: 0 160upx;padding-top: 100upx;}
	.no_text{font-size: 30upx;color: #999999;position: absolute;bottom: 28upx;}
</style>
